package org.ssh2.web.controller;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.annotation.Resource;

import org.ssh2.annotation.LogMsg;
import org.ssh2.core.entity.SoftRole;
import org.ssh2.core.entity.SoftUser;
import org.ssh2.web.AbstractBaseController;


import com.opensymphony.xwork2.util.CreateIfNull;
import com.opensymphony.xwork2.util.Element;
import com.opensymphony.xwork2.util.KeyProperty;

public class UserController extends AbstractBaseController {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7825266525716947869L;

	public SoftUser user;
	
	/**
	 * 配置页面传值映射
	 */
	
	@Element(org.ssh2.core.entity.SoftRole.class)
	@KeyProperty("id")
	@CreateIfNull(true)
	public Set<SoftRole> roles = new HashSet<>();
	
	//@LogMsg(msg ="登录失败")
	public String loginPrompt(){
		setPrompt("/login.jsp");
		System.out.println("密码错误");
		return SUCCESS;
	}
	
	//@LogMsg(msg = "用户登陆")
	public String doLogin(){
		System.out.println("doLogin()被执行了");
		System.out.println(",,");
		setPrompt("/test.jsp");
		System.out.println("用户登陆");
		System.out.println("ssssssss");
		return SUCCESS;
		
	}
	public SoftUser getUser() {
		return user;
	}

	public void setUser(SoftUser user) {
		this.user = user;
	}

	public Set<SoftRole> getRoles() {
		return roles;
	}

	public void setRoles(Set<SoftRole> roles) {
		this.roles = roles;
	}
	
	
}
